<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<%@ page contentType="text/html; charset=utf-8"%>
	<%@ include file="/commons/taglibs.jsp"%>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<title>角色菜单</title>

		<%@ include file="/commons/css_js_head.jsp"%>
		<script src="${ctx }/main/coommonjs/common.js" type="text/javascript"></script>
		<script type="text/javascript" src="${ctx}/dtree/dtree_checkbox_radio.js" ></script>
		<link rel="stylesheet" href="${ctx}/dtree/dtree.css" type="text/css"></link>

		<script type="text/javascript">
//复写Url
doListUrl = "${ctx }/permission/efRoleMenuAction!doList.ts";
doSaveUrl = "${ctx }/permission/efRoleMenuAction!doSave.ts";

function doSave(roleId) {
	var _form = document.forms[0];
	if (doSaveUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}
	
	if(!onCheckSelectedOneCheckBox('chkId')){
		alert('请至少选择一个菜单');
		return false;
	}
	
	var getValue = onGetValueFromSelectedCheckBox("chkId");
	
	_form.action = doSaveUrl+"?menuIds="+getValue+"&roleId="+roleId;
	_form.submit();
}

</script>


	</head>
	<body style="overflow-x: hidden">
		
		<form action="/permission/efRoleMenuAction!doSave.ts" method="post" >
		
		<!-- 标题 -->
		<div class="dtree">

		<br/>
		<img alt="全部打开" src="${ctx}/images/bant1.gif" onclick="d.openAll();"  />
		<img alt="全部折叠" src="${ctx}/images/bant2.gif" onclick="d.closeAll();" />
		<input name="btn_query" type="button" class="btn" value="确定" onclick="doSave('${requestScope.roleId}')" />
		<br/><br/>
			
		<script type="text/javascript">
				d = new dTree('d');
				d.add(0,-1,"菜单")
				
				flag = 1; //多选
				
				<c:forEach var="item" items="${voList}">
					d.add('${item.menuId}','${item.parentMenuId}',"${item.menuName}");
				</c:forEach>
				
				//获取该角色已经关联的菜单
				<c:forEach var="roleMenu" items="${requestScope.efRoleMenuList}" varStatus="status">
					currValueArray[<c:out value="${status.index}" />] = '<c:out value="${roleMenu.efMenu.menuId}" />';
				</c:forEach>
				
				document.write(d);
		</script>

		</div>
		</form>

<script>

//为全选框chkAll加上事件
initSelectAllCheckBox('chkAll','chkId');

var pageMsg = '${requestScope.pageMsg}'
if(pageMsg != ""){
	alert(pageMsg);
}
</script>

	</body>
</html>
